<cfcomponent name="personTabs" output="false">

<cffunction name="init" returntype="any" access="public" output="false">
	<cfargument name="personRecord" required="true" />
	<cfscript>
		variables.person = createObject("component", "actionpacks.people.model.person").init(arguments.personRecord);
		variables.personRecord = arguments.personRecord;
	</cfscript>
	<cfreturn this />
</cffunction>

<cffunction name="personTab" returntype="string" access="public" output="false">
	<cfsavecontent variable="result">
	 	<script language="javascript">
		 	function setTabUrl(theTab,theUrl) {
				var docPane = dojo.widget.getWidgetById(theTab);
				var tabCont= dojo.widget.getWidgetById("mainTabContainer");
				
				docPane.setUrl(theUrl);
				tabCont.selectTab(docPane);
		 	}
						
			function submitFormToEvent(formId,eventUrl,saveButton) {
				curSaveButton = saveButton;
			  dojo.io.bind ({
			    url: eventUrl,
			    handler: callBack,
			    formNode: dojo.byId(formId)
			  });
			}

			function callBack(type, data, evt) {
			   dojo.byId('explode').innerHTML = data;
			   saveButton = curSaveButton;
				 explodeIt = dojo.lfx.explode(saveButton, "explode", 250);
				 //explodeIt = dojo.lfx.html.fadeIn('explode', 600);
				 wipeIt = dojo.lfx.html.fadeOut('explode', 2600);
				 implodeIt = dojo.lfx.html.implode('explode',saveButton, 100);
				 dojo.lfx.chain(explodeIt,wipeIt,implodeIt).play();
				 //dojo.lfx.chain(explodeIt).play();
			}

			function loadData(_recordrow,_currentrow)
			{
				//alert(_recordrow+ ' ' + _currentrow);
				setTabUrl('personTab','?event=person.view&personId=' + _recordrow)
	    }
			
		</script>
		<style >
		#explode {
			position : absolute;
			left : 500px;
			top : 100px;
			background : #ddd;
			width : 400px;
			height : 300px;
			text-align : center;
			display : none;
		}		
		</style>
	<cfoutput>

			<cfset daGroupsQry = variables.personrecord.getGroupsIterator().getQuery()>
			<div id="explode">EXPLODE!!!</div>
			<a dojoType="LinkPane" id="peopleTab" href="?event=people.view" refreshOnShow="false" cacheContent="false" executeScripts="true">People</a>
			<a dojoType="LinkPane" id="personTab" href="?event=person.view&personId=#variables.personRecord.getPersonId()#" executeScripts="true" refreshOnShow="false" cacheContent="false" selected="true">Person</a>
		</cfoutput>
	</cfsavecontent>
	<cfreturn result />
</cffunction>

<cffunction name="renderAvailableTabs" returntype="string" access="public" output="false">
  <cfreturn personTab()>
</cffunction>

</cfcomponent>

 